<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>  	
<div class="alert alert-info">查询条件</div>
<form action="${pageContext.request.contextPath}/FindProductsServlet" method="GET" style="margin-bottom: 15px;">
	<input type="hidden" name="page" value="1">
	<div class="row">
		<div class="col-md-6">
			<div class="form-group">
			  <label>商品编号</label>
			  <input type="text" class="form-control">
			</div>
			<div class="form-group">
			  <label>商品名称</label>
			  <input type="text" class="form-control">
			</div>
		</div>
		<div class="col-md-6">
			<div class="form-group">
			  <label>类别</label>
			  <select class="form-control">
				  <option>1</option>
				  <option>2</option>
				  <option>3</option>
				  <option>4</option>
				  <option>5</option>
				</select>
			</div>
			<div class="form-group">
			  <label>价格区间（元）</label>
			  <div class="row">
			  	<div class="col-md-6">
			  		<input type="text" class="form-control">
			  	</div>
			  	<div class="col-md-6">
			  		<input type="text" class="form-control">
			  	</div>
			  </div>
			</div>
		</div>
	</div>
	<div class="clearfix" style="margin-bottom: 15px;">
		<button type="reset" class="btn btn-primary pull-right">重置</button>
		<button type="submit" class="btn btn-primary pull-right" style="margin-right: 15px;">查询</button>
	</div>
</form>
<div class="alert alert-info">商品列表</div>
<div class="clearfix" style="margin-bottom: 15px;">
	<a class="btn btn-primary pull-right" href="${pageContext.request.contextPath}/server/login/home.jsp?item=<%="product_add"%>">添加</a>
</div>
<table class="table table-bordered">
	<tr>
		<th>商品编号</th>
		<th>商品名称</th>
		<th>商品价格</th>
		<th>商品数量</th>
		<th>商品类别</th>
		<th>编辑</th>
		<th>删除</th>
	</tr>
	<c:forEach items="${products}" var="product">
	<tr>
		<td><c:out value="${product.id}" /></td>
		<td><c:out value="${product.name}" /></td>
		<td><c:out value="${product.price}" /></td>
		<td><c:out value="${product.pnum}" /></td>
		<td><c:out value="${product.category}" /></td>
		<td><a href="${pageContext.request.contextPath}/EditProductServlet?id=${product.id}" class="btn btn-warning">编辑</button></td>
		<td><a href="${pageContext.request.contextPath}/DeleteProductServlet?id=${product.id}" class="btn btn-danger">删除</a></td>
	</tr>
	</c:forEach>
</table>
<nav>
  <ul class="pager">
  	<c:if test="${hasPrev}">
  		<li class="previous"><a href="${pageContext.request.contextPath}/FindProductsServlet?page=${_page - 1}"><span aria-hidden="true">&larr;</span>上一页</a></li>
  	</c:if>
  	<c:if test="${hasNext}">
    	<li class="next"><a href="${pageContext.request.contextPath}/FindProductsServlet?page=${_page + 1}">下一页 <span aria-hidden="true">&rarr;</span></a></li>
  	</c:if>
  </ul>
</nav>